package com.neusoft.lohas.modules.ivm.enums.order;

/**
 * 支付类型枚举类
 * @author jackie.liu
 * @version 2014-12-16
 */
public enum PayTypeEnum {

	CASH_ON_DELIVERY(1, "货到付款", 1), 
	ALIPAY(2, "支付宝", 2),
	UNIONPAY(3, "银联", 3),
	WECHAT(4, "微信", 4);

	private int type;
	private String desc;
	private int dbType;

	private PayTypeEnum(int type, String desc, int dbType) {
		this.type = type;
		this.desc = desc;
		this.dbType = dbType;
	}

	public static PayTypeEnum getEnumByStatus(int type, String... params) {
		PayTypeEnum[] enums = PayTypeEnum.values();
		for (PayTypeEnum item : enums) {
			if (item.getType() == type)
				return item;
		}
		return null;
	}
	
	public static String getEnumPayTypeDescByStatus(int type) {
		PayTypeEnum[] enums = PayTypeEnum.values();
		for (PayTypeEnum item : enums) {
			if (item.getType() == type)
				return item.getDesc();
		}
		return null;
	}

	public static PayTypeEnum getEnumByDbStatus(int dbType, String... params) {
		PayTypeEnum[] enums = PayTypeEnum.values();
		for (PayTypeEnum item : enums) {
			if (item.getDbType() == dbType)
				return item;
		}
		return null;
	}
	
	public static String getEnumDescByDbStatus(int dbType) {
		PayTypeEnum[] enums = PayTypeEnum.values();
		for (PayTypeEnum item : enums) {
			if (item.getDbType() == dbType)
				return item.getDesc();
		}
		return null;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public int getDbType() {
		return dbType;
	}

	public void setDbType(int dbType) {
		this.dbType = dbType;
	}

}
